<template>
  <div style="height: 100%; width: 100%; position: relative">
      <div class="pagetop">
          <template>
              <div style="width: 100%">
                  <div style="float: left; width: 50%">
                      <table style="font-size: 12px" class="table1style">
                          <tr>
                              <td>快速查询</td>
                              <td>
                                  <el-input v-model="txtsearch" placeholder="收费项目代码或收费项目名称或拼音码或HIS对应项目代码" style="width: 350px" @input="specifiName($event)" clearable></el-input>
                              </td>
                          </tr>
                      </table>
                  </div>
                  <div style="float: left; width: 50%">
                      <table style="float: right">
                          <tr>
                              <td>
                                  <el-button type="primary" @click="btnRefresh" icon="el-icon-search" v-has="'PINQUERY'">查询</el-button>
                              </td>
                              <td>
                                  <el-button @click="btnAdd" icon="el-icon-plus" v-has="'PADD'">新增</el-button>
                              </td>
                              <td>
                                  <el-button @click="btnDelete" icon="el-icon-delete" v-has="'PDELETE'">删除</el-button>
                              </td>
                              <td>
                                  <el-button @click="SaveRecord" icon="el-icon-document">保存</el-button>
                              </td>
                              <td>
                                  <el-button @click="syncdata" icon="el-icon-position" v-has="'PSYNC'">同步</el-button>
                              </td>
                              <td>
                                  <el-button @click="btnPrintDict" icon="el-icon-printer">打印</el-button>
                              </td>
                              <td>
                                  <el-button @click="RecordExport" icon="el-icon-download" v-has="'PEXPORT'">导出</el-button>
                              </td>
                              <td>
                                  <el-button @click="Checkdept" icon="el-icon-position" v-has="'PSYNC'">执行科室对照</el-button>
                              </td>
                          </tr>
                      </table>
                  </div>
              </div>
          </template>
      </div>
      <div class="pagecenter">
          <div class="middle-center" style="height: 100%">
              <vxe-table :loading="loading" :data.sync="tableData" :row-class-name="rowClassName" border fit :mouse-config="{ selected: true }" :edit-config="{ trigger: 'click', mode: 'cell', activeMethod: activeMethod, showStatus: true, showIcon: false }" @edit-actived="CellActive" :keyboard-config="keyConfig" height="auto" header-align="center" @edit-closed="EditChange" :cell-class-name="cellClassName" highlight-current-row highlight-hover-row ref="xTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" stripe>
                  <vxe-table-column type="index" title="NO." width="40" align="center"></vxe-table-column>
                  <vxe-table-column field="feeitemcode" title="收费项目代码" width="100" :edit-render="{ name: 'input', autoselect: true }" sortable> </vxe-table-column>
                  <vxe-table-column field="feeitemname" title="收费项目名称" width="200" sortable :edit-render="{ name: 'input', autoselect: true }"> </vxe-table-column>
                  <vxe-table-column field="perform_dept" title="执行科室" width="150" sortable :edit-render="{ name: 'input', autoselect: true }"> </vxe-table-column>
                  <vxe-table-column field="item_price" title="价格" width="100" sortable align="center" :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
                  <vxe-table-column field="inputcode" title="拼音码" width="100" sortable :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
                  <vxe-table-column field="his_class" title="HIS项目类别" width="100" sortable :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
                  <vxe-table-column field="his_itemcode" title="HIS对应项目代码" width="100" sortable :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
                  <vxe-table-column field="begindate" title="启用时间" width="135" sortable>
                      <template v-slot="{ row }">
                          <el-date-picker v-model="row.begindate" type="date" placeholder="启用时间" value-format="yyyy-MM-dd" clearable style="width: 135px"></el-date-picker>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="enddate" title="停用时间" width="135" sortable>
                      <template v-slot="{ row }">
                          <el-date-picker v-model="row.enddate" type="date" placeholder="停用时间" value-format="yyyy-MM-dd" clearable style="width: 135px"></el-date-picker>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column align="center" field="useflag" sortable title="有效" width="70">
                      <template v-slot="{ row }">
                          <el-checkbox v-model="row.useflag" true-label="1" false-label="0"></el-checkbox>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="lastmodifydate" title="最后修改时间" width="120" sortable></vxe-table-column>
                  <vxe-table-column field="refresh_log" title="同步备注信息" width="100" sortable></vxe-table-column>
                  <vxe-table-column field="feecount_class" title="统计类别" width="100" sortable :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
              </vxe-table>
          </div>
      </div>
      <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
          <span><span class="el-icon-info">确定删除病人类型名称为<b style="color: red">{{ message }}</b>的记录吗？</span></span>
          <span slot="footer" class="dialog-footer">
              <el-button @click="SubmitDel">确 定</el-button>
              <el-button @click="dialogVisible = false">取 消</el-button>
          </span>
      </el-dialog>

      <!--多选弹窗--->
      <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="执行科室对照" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
          <div style="width: 100%">
              <div>
                  <div class="diapagetop">
                      <div style="width: 100%; height: 100%">
                          <div style="width: 430px; float: left">
                              <el-input v-model.trim="txtSqlListQuery" placeholder="请输入查询条件" style="width: 420px" ref="refsearch" clearable></el-input>
                          </div>
                          <div style="width: 420px; float: right">
                              <span style="font-size: 12px">执行科室：</span>
                              <el-select v-model="performbydept" style="width: 100px" @change="QueryPerformby" clearable>
                                  <el-option v-for="(item, index) in deptoption" :label="item.deptname" :value="item.deptno" :key="index"></el-option>
                              </el-select>
                              &nbsp;&nbsp;
                              <el-button @click="SqlDialogVisibleSave" style="margin-left: 1px">保 存</el-button>
                              <el-button @click="SqlDialogVisibleCancel" type="primary" style="margin-left: 1px">取 消</el-button>
                          </div>
                      </div>
                  </div>
                  <div class="diapagecenter">
                      <div style="width: 430px">
                          <vxe-grid :columns="tableColumn" height="auto" header-align="center" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" border :optimization="{ scrollY: { gt: 1000 } }" @cell-dblclick="SQLSelectEvent" :data.sync="list" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="PopxTableLeft" resizable size="mini" stripe :key="leftkey"> </vxe-grid>
                      </div>
                      <div class="table-deal-btn">
                          <div>
                              <el-button class="el-icon-right" @click="SQLSelectEvent"></el-button>
                          </div>
                          <div>
                              <el-button class="el-icon-back" @click="SQLNoSelectEvent"></el-button>
                          </div>
                          <div>
                              <el-button class="el-icon-d-arrow-right" @click="SqlAllSelect"></el-button>
                          </div>
                          <div>
                              <el-button class="el-icon-d-arrow-left" @click="SqlAllNoSelect"></el-button>
                          </div>
                      </div>
                      <div style="width: 430px">
                          <vxe-grid :columns="tableColumn" height="auto" header-align="center" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" border @cell-dblclick="SQLNoSelectEvent" @current-change="SqlCurrSelectEvent" :data.sync="rightSqlListOptions" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="PopxTableRight" resizable size="mini" stripe :key="rightkey"> </vxe-grid>
                      </div>
                  </div>
                  <div v-show="false">{{ leftSqlListOptions }}</div>
              </div>
          </div>
      </el-dialog>

      <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
          <span><span class="el-icon-info">确定删除病人类型名称为<b style="color: red">{{ message }}</b>的记录吗？</span></span>
          <span slot="footer" class="dialog-footer">
              <el-button @click="SubmitDel">确 定</el-button>
              <el-button @click="dialogVisible = false">取 消</el-button>
          </span>
      </el-dialog>
  </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
export default {
  name: "MNG232",
  data() {
      return {
          tableData: [],
          tableData1: [],
          message: "",
          selectrow: [],
          curselectrow: "",
          actionindex: 0,
          tempindex: 0,
          loading: false,
          dialogVisible: false,
          ishsow: false,
          okFirstLoading: true,
          performbydept: "",
          dialogMultipleVisible: false,
          deptoption: [],
          rightSqlListOptions: [],
          leftSqlListOptions: [],
          txtSqlListQuery: "",
          nowtime: "",
          selectConfig: { tigger: "row" },
          leftkey: 0,
          rightkey: 0,
          tableColumn: [
              { type: "index", title: "NO.", width: 50, align: "center" },
              { field: "feeitemcode", title: "收费项目代码", width: 80 },
              { field: "feeitemname", title: "收费项目名称", width: 150 },
              { field: "perform_dept", title: "执行科室", width: 100 },
          ],
          keyConfig: {
              isArrow: true,
              isDel: true,
              isTab: true,
              isEdit: true,
          },
          txtsearch: "",
      };
  },
  computed: {
      list() {
          let filterName = this.txtSqlListQuery;
          if (filterName) {
              let rest = this.leftSqlListOptions.filter((item) => {
                  if (item.hasOwnProperty("inputcode")) {
                      return (item.data ? item.data.toString().toUpperCase().indexOf(filterName.toString().toUpperCase()) > -1 : false) || (item.display ? item.display.indexOf(filterName) > -1 : false) || (item.inputcode ? item.inputcode.toString().toUpperCase().indexOf(filterName.toString().toUpperCase()) > -1 : false);
                  } else {
                      return (item.data ? item.data.toString().toUpperCase().indexOf(filterName.toString().toUpperCase()) > -1 : false) || (item.display ? item.display.indexOf(filterName) > -1 : false);
                  }
              });
              return rest;
          } else {
              return this.leftSqlListOptions;
          }
      },
      // tableData() {
      //     let querystr = this.txtsearch.trim();
      //     if (querystr) {
      //         let rest = this.tableData1.filter((item) => item.feeitemcode.indexOf(querystr) > -1 || item.feeitemname.indexOf(querystr) > -1 || (item.inputcode ? item.inputcode.toUpperCase().indexOf(querystr.toUpperCase()) > -1 || item.his_itemcode.indexOf(querystr) > -1 : false));
      //         return rest;
      //     } else {
      //         return this.tableData1;
      //     }
      // },
  },
  created() {
      this.InitPage(); //初始化主列表
      this.leftkey++;
      this.rightkey++;
  },
  mounted() {},

  updated() {
      if (this.okFirstLoading) {
          let currentrow = "";
          if (this.actionindex != 0) {
              //新增，修改，删除
              if (this.actionindex == 3) {
                  //如果是删除
                  if (this.tempindex > 0) {
                      currentrow = this.$refs.xTable.getData(this.tempindex);
                  } else {
                      currentrow = this.$refs.xTable.getData(0);
                  }
              } else {
                  //新增或修改
                  if (this.curselectrow && this.curselectrow != "") {
                      this.$nextTick(() => {
                          let row = this.curselectrow;
                          var alld = this.$refs.xTable.tableData;
                          for (var i = 0; i < alld.length; i++) {
                              if (alld[i].codeno == row.codeno) {
                                  this.tempindex = i;
                                  break;
                              }
                          }
                          currentrow = this.$refs.xTable.getData(this.tempindex);
                      });
                  } else {
                      currentrow = this.$refs.xTable.getData(0);
                  }
              }
          } else {
              //查询
              currentrow = this.$refs.xTable.getData(0);
              this.actionindex = 2;
              this.curselectrow = currentrow;
          }
          this.$nextTick(() => {
              if (currentrow) {
                  this.okFirstLoading = false;
                  this.$refs.xTable.setCurrentRow(currentrow);
                  this.message = currentrow.codena;
              }
          });
      }
  },
  methods: {
      syncdata() {
          this.loading = true;
          this.$tool
              .request({
                  url: "MNG/MNG2/MNG232",
                  method: "post",
                  data: {
                      action: "syncdata",
                  },
              })
              .then((response) => {
                  if (response.err == 0) {
                      let msg = response.msg;
                      if (!msg) msg = "同步数据获取失败！";
                      this.loading = false;
                      this.$alert(msg);
                      return;
                  }
                  // this.nowtime = response.nowtime;
                  // let data = response.data;
                  // data.forEach((item) => {
                  //     debugger;
                  //     let rest = this.$refs.xTable.tableData.filter((element) => element.feeitemcode.toUpperCase() == item.feeitemcode.toUpperCase());
                  //     if (rest.length > 0) {
                  //         try {
                  //             rest.forEach((ele) => {
                  //                 if (ele.feeitemcode.toUpperCase() == item.feeitemcode.toUpperCase()) {
                  //                     ele.feeitemname = item.feeitemname;
                  //                     ele.hospcode = item.hospcode;
                  //                     ele.his_itemcode = item.his_itemcode;
                  //                     ele.his_class = item.his_class == "" ? ele.his_class : item.his_class;
                  //                     ele.perform_dept = item.perform_dept == "" ? ele.perform_dept : item.perform_dept;
                  //                     ele.inputcode = item.inputcode == "" ? ele.inputcode : item.inputcode;
                  //                     ele.item_price = item.item_price == "" ? ele.item_price : item.item_price;
                  //                     ele.begindate = item.begindate == "" ? ele.begindate : item.begindate;
                  //                     ele.enddate = ele.enddate == item.enddate ? null : ele.enddate;
                  //                     ele.useflag = ele.useflag == item.useflag ? null : ele.useflag;
                  //                     ele.lastmodifydate = ele.lastmodifydate == item.lastmodifydate ? null : ele.lastmodifydate;
                  //                     ele.refresh_log = ele.refresh_log == item.refresh_log ? null : ele.refresh_log;
                  //                     ele.feecount_class = ele.feecount_class == item.feecount_class ? null : ele.feecount_class;
                  //                     throw Error();
                  //                 }
                  //             });
                  //         } catch (e) {}
                  //     } else {
                  //         let initialdata = {
                  //             feeitemcode: item.feeitemcode,
                  //             feeitemname: item.feeitemname,
                  //             hospcode: item.hospcode == "" ? "All" : item.hospcode,
                  //             his_itemcode: item.his_itemcode,
                  //             his_class: item.his_class,
                  //             perform_dept: item.perform_dept,
                  //             inputcode: item.inputcode,
                  //             item_price: item.item_price,
                  //             begindate: new Date(),
                  //             enddate: "2099-12-31",
                  //             useflag: "1",
                  //             lastmodifydate: item.lastmodifydate,
                  //             refresh_log: item.refresh_log,
                  //             feecount_class: item.feecount_class,
                  //         };
                  //         this.$refs.xTable.insert(initialdata);
                  //     }
                  // });
                  this.loading = false;
                  setTimeout(() => {
                      this.$message.success("收费项目字典数据更新完成！");
                  }, 500);
                  this.InitPage();
              })
              .catch((e) => {
                  console.log("error", e);
                  this.loading = false;
              });
      },
      QueryPerformby(val) {
          this.$tool
              .request({
                  url: "MNG/MNG2/MNG232",
                  method: "post",
                  data: {
                      action: "QueryPerformby",
                      deptno: val,
                  },
              })
              .then((res) => {
                  this.rightSqlListOptions = res.deptoption;
                  this.leftSqlListOptions = XEUtils.clone(this.tableData, true);
                  this.rightSqlListOptions.forEach((x) => {
                      var rowindex = this.leftSqlListOptions.indexOf((y) => y.feeitemcode == x.feeitemcode);
                      this.leftSqlListOptions.splice(rowindex, 1);
                  });
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      SqlDialogVisibleSave() {
          this.$tool
              .request({
                  url: "MNG/MNG2/MNG232",
                  method: "post",
                  data: {
                      action: "SavePerformby",
                      deptno: this.performbydept,
                      data: this.rightSqlListOptions,
                  },
              })
              .then((res) => {
                  if ((res.flag = "1")) this.$message.success("保存成功！");
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      SqlDialogVisibleCancel() {
          this.dialogMultipleVisible = false;
      },
      Checkdept() {
          this.dialogMultipleVisible = true;
          this.performbydept = "";
          this.rightSqlListOptions = [];
          this.leftSqlListOptions = XEUtils.clone(this.tableData, true);
      },
      SQLSelectEvent() {
          try {
              if (this.performbydept != "") {
                  var delrow = this.$refs.PopxTableLeft.getCurrentRow();
                  if (delrow) {
                      var alld = this.leftSqlListOptions;
                      var rowindex = alld.indexOf(delrow);
                      this.leftSqlListOptions.splice(rowindex, 1);
                      let Rlen = 0;
                      if (this.rightSqlListOptions != null) {
                          Rlen = this.rightSqlListOptions.length;
                      } else {
                          this.rightSqlListOptions = [];
                      }
                      this.rightSqlListOptions.splice(Rlen, 0, delrow);
                      let havedata = this.leftSqlListOptions;
                      if (havedata.length > 0) {
                          if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                          let selectrow = havedata[rowindex];
                          this.$refs.PopxTableLeft.setCurrentRow(selectrow);
                      } else {
                          this.$refs.PopxTableLeft.setCurrentRow(null);
                      }
                  }
              } else {
                  this.$message.warning("请选择执行科室！");
              }
          } catch (e) {
              alert(e);
          }
      }, //单选，左移
      SQLNoSelectEvent() {
          try {
              var delrow = this.$refs.PopxTableRight.getCurrentRow();
              if (delrow) {
                  var alld = this.rightSqlListOptions;
                  var rowindex = alld.indexOf(delrow);
                  this.rightSqlListOptions.splice(rowindex, 1);
                  let Llen = 0;
                  if (this.leftSqlListOptions != null) {
                      Llen = this.leftSqlListOptions.length;
                  } else {
                      this.leftSqlListOptions = [];
                  }
                  this.leftSqlListOptions.splice(Llen, 0, delrow);
                  let havedata = this.rightSqlListOptions;
                  if (havedata.length > 0) {
                      if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                      let selectrow = havedata[rowindex];
                      this.$refs.PopxTableRight.setCurrentRow(selectrow);
                  } else {
                      this.$refs.PopxTableRight.setCurrentRow(null);
                  }
              }
          } catch (e) {
              alert(e);
          }
      },
      SqlAllSelect() {
          //全选 右移
          let sdata = XEUtils.clone(this.leftSqlListOptions, true);
          if (sdata.length > 0) {
              sdata.forEach((delrow, rowindex) => {
                  this.leftSqlListOptions.splice(rowindex, 1);
                  this.$refs.PopxTableLeft.remove(delrow);
                  let Rlen = 0;
                  if (this.rightSqlListOptions != null) {
                      Rlen = this.rightSqlListOptions.length;
                  } else {
                      this.rightSqlListOptions = [];
                  }
                  this.rightSqlListOptions.splice(Rlen, 0, delrow);
              });
              this.leftSqlListOptions = [];
          } else {
              this.leftSqlListOptions = [];
          }
      },
      SqlAllNoSelect() {
          //全不选 左移
          let sdata = XEUtils.clone(this.rightSqlListOptions, true);
          if (sdata.length > 0) {
              sdata.forEach((delrow, rowindex) => {
                  this.rightSqlListOptions.splice(rowindex, 1);
                  let Llen = 0;
                  if (this.leftSqlListOptions == null) {
                      this.leftSqlListOptions = [];
                  } else {
                      Llen = this.leftSqlListOptions.length;
                  }
                  this.leftSqlListOptions.splice(Llen, 0, delrow);
              });
              this.rightSqlListOptions = [];
          }
      },
      //SQL多选排序
      SqlCurrSelectEvent({ rowIndex }) {
          this.sqlcurrRowIndex = rowIndex;
      },
      InitPage() {
          this.loading = true;
          this.$tool
              .request({
                  url: "MNG/MNG2/MNG232",
                  method: "post",
                  data: {
                      action: "query",
                  },
              })
              .then((res) => {
                  this.deptoption = res.deptoption;
                  this.tableData = res.data.Data;
                  this.leftSqlListOptions = XEUtils.clone(res.data.Data, true);
                  this.loading = false;
                  this.okFirstLoading = true;
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      btnRefresh() {
          this.InitPage();
      },
      activeMethod({ row, column }) {
          if (column.property == "securityflag") {
              return false;
          } else {
              return true;
          }
      },
      rowClassName({ row, rowIndex }) {
          let isDirty = this.$refs.xTable.hasRowChange(row);
          if (isDirty) {
              return "row-modify";
          }
          if (this.$refs.xTable.hasRowInsert(row)) return "row-new";
      },
      currentChangeEvent({ row, $rowIndex }) {
          this.message = row.codena;
          this.actionindex = 2; //修改
          this.tempindex = $rowIndex;
          this.curselectrow = row;
      },
      btnAdd() {
          let initdata = {
              feeitemcode: "",
              feeitemname: "",
              hospcode: "",
              his_itemcode: "",
              his_class: "",
              perform_dept: "",
              inputcode: "",
              item_price: 0,
              begindate: new Date(),
              enddate: "2099-12-31",
              useflag: "1",
              lastmodifydate: "",
              refresh_log: "",
              feecount_class: "",
          };
          this.$refs.xTable.insert(initdata).then(({ row }) => {
              this.$refs.xTable.setCurrentRow(row);
              this.$refs.xTable.setActiveRow(row, "feeitemcode");
          });
          this.actionindex = 1; //增加
          this.FunscrollY();
      },
      FunscrollY() {
          this.$nextTick(() => {
              var alldataLen = this.$refs.xTable.tableData.length;
              let L = this.$refs.xTable.getTableData().fullData[alldataLen - 1];
              this.$refs.xTable.scrollToRow(L);
          });
      },
      btnDelete() {
          this.dialogVisible = true;
      },
      SubmitDel() {
          let delrow = this.$refs.xTable.getCurrentRow();
          if (delrow) {
              var alld = this.$refs.xTable.tableData;
              var rowindex = alld.indexOf(delrow);
              this.$refs.xTable.remove(delrow);
              this.actionindex = 3; //删除
              let havedata = this.$refs.xTable.tableData;
              if (havedata.length > 0) {
                  if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                  this.tempindex = rowindex;
                  let selectrow = havedata[rowindex];
                  this.$refs.xTable.setCurrentRow(selectrow);
                  this.message = selectrow.codena;
              }
          } else {
              this.$message({
                  message: "请选择要删除的记录！",
                  type: "warning",
              });
          }
          this.dialogVisible = false;
      },
      EditChange({ row, column, rowIndex }) {
          if (column.property == "codena") {
              row.inputcode = this.$pub.CreateInputcode(row.codena, this, 16);
          }
      },
      SaveRecord() {
          let tabledata = this.$refs.xTable.getRecordset();
          if (tabledata.insertRecords.length > 0) {
              this.curselectrow = tabledata.insertRecords[0];
          }
          this.$tool
              .request({
                  url: "MNG/MNG2/MNG232",
                  method: "post",
                  data: {
                      action: "save",
                      urec: tabledata,
                  },
              })
              .then((response) => {
                  if (response.errcode == "1") {
                      this.$message({
                          message: "操作成功！",
                          type: "success",
                      });
                      this.InitPage();
                  } else {
                      this.$message({
                          message: "保存失败！" + response.errmsg,
                          type: "warning",
                      });
                  }
              });
      },
      RecordExport() {
          this.$refs.xTable.exportCsv({ filename: "MNG232 收费项目字典" });
      },
      btnPrintDict() {
          let dataLength = 45; //定义最多打印多少数据

          this.$pub.printDict(this, "MNG232 收费项目字典", this.$refs.xTable);
      },
      CellActive({ row, rowIndex, column }) {
          this.actionindex = 2; //修改
          let len = this.$refs.xTable.tableData.length;
          if (rowIndex + 1 >= len) {
              if (row.codeno === null) {
                  row.kindno = "PT";
                  row.securityflag = "U";
                  this.$refs.xTable.setCurrentRow(row);
                  this.actionindex = 1; //新增
                  this.tempindex = this.$refs.xTable.getRowIndex(row);
              }
          }
      },
      //控制列的颜色
      cellClassName({ row, column }) {
          if (["kindno", "securityflag"].includes(column.property)) {
              return this.$pub.diseditcolumn();
          } else if (column.title == "NO.") {
              return this.$pub.diseditcolumn();
          }
      },
      specifiName(e) {
          if (e == null || e == "") {
              this.btnRefresh();
          } else {
              this.$tool
                  .request({
                      url: "MNG/MNG2/MNG232",
                      method: "post",
                      data: {
                          action: "query",
                      },
                  })
                  .then((res) => {
                      this.tableData1 = res.data.Data;
                      let rest = this.tableData1.filter((item) => item.feeitemcode.indexOf(e) > -1 || item.feeitemname.indexOf(e) > -1 || (item.inputcode ? item.inputcode.toUpperCase().indexOf(e.toUpperCase()) > -1 || item.his_itemcode.indexOf(e) > -1 : false));
                      this.tableData = rest;
                  })
                  .catch((e) => {
                      console.log("error", e);
                  });
          }
          //this.$refs.xTable.data = this.tableData1;
      },
  },
};
</script>

<style scoped>
.pagetop {
  width: 100%;
  height: 35px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter {
  position: absolute;
  top: 40px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}
.diapagetop {
  width: 100%;
  height: 35px;
  -webkit-box-pack: left;
  -webkit-box-align: center;
}

.diapagecenter {
  height: 400px;
  width: 100%;
  display: flex;
}
.table-deal-btn {
  text-align: center;
  margin: auto 10px;
}
.table-deal-btn div {
  margin: 5px 0;
}
.middle-center {
  position: absolute;
  height: 100%;
  left: 0px;
  right: 0px;
  overflow: auto;
}
/deep/.middle-center tr td div .el-input__inner {
  border: 1px solid rgba(255, 254, 254, 0) !important;
  background-color: rgba(255, 254, 254, 0) !important;
}
/deep/ .vxe-table .vxe-body--column.col-orange {
  background-color: #ccc;
}
/deep/ tr.vxe-body--row.row-modify {
  color: blue !important;
}
</style>